// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/dashboard/dashujv',
    children: [
      //工作台
      {
        path: '/dashboard',
        name: 'dashboard',
        redirect: '/dashboard/dashujv',
        component: RouteView,
        meta: { title: '首页', icon: bxAnaalyse },
        children: [
          {
            path: '/dashboard/dashujv',
            name: 'dashujv',
            component: () => import('@/views/dashboard/dashujv'),
            meta: { title: '工作台', keepAlive: true }
          }
        ]
      },
      //系统配置
      {
        path: '/system',
        name: 'system',
        redirect: '/system/menu',
        component: PageView,
        meta: { title: '系统管理', icon: 'setting', permission: ['system'] },
        children: [
          {
            path: '/system/menu',
            name: 'menu',
            component: () => import('@/pages/system/menu/menuList'),
            meta: { title: '菜单管理', permission: ['menu'] }
          },
          {
            path: '/system/role',
            name: 'role',
            component: () => import('@/pages/system/role/roleList'),
            meta: { title: '角色管理', permission: ['role'] }
          },
          {
            path: '/system/config',
            name: 'config',
            component: () => import('@/pages/system/config/configList'),
            meta: { title: '系统配置管理', permission: ['config'] }
          },
          {
            path: '/system/company',
            name: 'company',
            component: () => import('@/pages/system/company/companyInfo'),
            meta: { title: '服务商管理', permission: ['company'] }
          },
          {
            path: '/system/companyUser',
            name: 'userList',
            component: () => import('@/pages/system/company/userList'),
            meta: { title: '服务商账号管理', permission: ['userList'] }
          },
          {
            path: '/system/businessDistrict',
            name: 'businessDistrict',
            component: () => import('@/pages/system/businessDistrict/businessDistrictList'),
            meta: { title: '商圈信息', permission: ['businessDistrictList'] }
          }
        ]
      },
      //小程序管理
      {
        path: '/mini',
        name: 'mini',
        redirect: '/mini/customer',
        component: PageView,
        meta: { title: '商圈管理', icon: 'shop', permission: ['mini'] },
        children: [
          {
            path: '/mini/customer',
            name: 'customerInfo',
            component: () => import('@/pages/mini/customer/customerInfo'),
            meta: { title: '我的商圈', permission: ['customerInfo'] }
          },
          {
            path: '/mini/customerUser',
            name: 'miniuserList',
            component: () => import('@/pages/mini/customer/userList'),
            meta: { title: '小程序登录账号', permission: ['miniuserList'] }
          },
          {
            path: '/mini/miniMenu',
            name: 'menuList',
            component: () => import('@/pages/mini/miniMenu/miniMenuList'),
            meta: { title: '小程序菜单', permission: ['menuList'] }
          },
          {
            path: '/mini/customerBanner',
            name: 'customerBannerList',
            component: () => import('@/pages/mini/customer/customerBannerList'),
            meta: { title: '轮播图列表', permission: ['customerBannerList'] }
          },
          {
            path: '/mini/customerPic',
            name: 'customerPicList',
            component: () => import('@/pages/mini/customer/customerPicList'),
            meta: { title: '九宫格列表', permission: ['customerPicList'] }
          }
        ]
      },
      //微信营销管理
      {
        path: '/Marketing',
        name: 'Marketing',
        redirect: '/Marketing/activityTimeList',
        component: PageView,
        meta: { title: '微信营销管理', icon: 'shop', permission: ['Marketing'] },
        children: [
          {
            path: '/Marketing/activity',
            name: 'activityTimeList',
            component: () => import('@/pages/Marketing/activity/activityTimeList'),
            meta: { title: '限时抢购', permission: ['activityTimeList'] }
          },
          {
            path: '/Marketing/huodong',
            name: 'huodongList',
            component: () => import('@/pages/Marketing/huodong/huodongList'),
            meta: { title: '普通活动', permission: ['huodongList'] }
          },
          {
            path: '/Marketing/jifen',
            name: 'jifenList',
            component: () => import('@/pages/Marketing/jifen/jifenList'),
            meta: { title: '积分商城', permission: ['jifenList'] }
          },
          {
            path: '/Marketing/game',
            name: 'gameList',
            component: () => import('@/pages/Marketing/game/gameList'),
            meta: { title: '大转盘配置', permission: ['gameList'] }
          },
          {
            path: '/product/addDazhuanpan',
            name: 'zhuanpanList',
            component: () => import('@/pages/product/addDazhuanpan/zhuanpanList'),
            meta: { title: '大转盘商品', permission: ['zhuanpanList'] }
          },
          {
            path: '/Marketing/game/createCode',
            name: 'createCode',
            hidden: true,
            component: () => import('@/pages/Marketing/game/createCode'),
            meta: { title: '大转盘抽奖码', permission: ['createCode'] }
          }
        ]
      },
      //支付宝营销管理
      {
        path: '/aliMarketing',
        name: 'aliMarketing',
        redirect: '/aliMarketing/activityTimeList',
        component: PageView,
        meta: { title: '支付宝营销管理', icon: 'shop', permission: ['aliMarketing'] },
        children: [
          {
            path: '/aliMarketing/jifen',
            name: 'alijifenList',
            component: () => import('@/pages/aliMarketing/jifen/jifenList'),
            meta: { title: '积分商城', permission: ['alijifenList'] }
          },
        ]
      },
      //商户管理
      {
        path: '/merchant',
        name: 'merchant',
        redirect: '/mini/merchant',
        component: PageView,
        meta: { title: '商户管理', icon: 'shop', permission: ['merchant'] },
        children: [
          {
            path: '/system/merchant',
            name: 'merchantInfo',
            component: () => import('@/pages/system/merchant/merchantInfo'),
            meta: { title: '我的商户', permission: ['merchantInfo'] }
          },
          {
            path: '/system/coupon',
            name: 'couponInfo',
            component: () => import('@/pages/system/coupon/couponInfo'),
            meta: { title: '优惠券管理', permission: ['couponInfo'] }
          },
          {
            path: '/mini/category',
            name: 'categoryList',
            component: () => import('@/pages/mini/category/categoryList'),
            meta: { title: '业态管理', permission: ['categoryList'] }
          },
          {
            path: '/mini/brandList',
            name: 'brandList',
            component: () => import('@/pages/merchant/brand/brandList'),
            meta: { title: '品牌分类', permission: ['brandList'] }
          },
          {
            path: '/mini/floorList',
            name: 'floorList',
            component: () => import('@/pages/merchant/floor/floorList'),
            meta: { title: '楼层分类', permission: ['floorList'] }
          },
          {
            path: '/mini/store',
            name: 'storeInfo',
            component: () => import('@/pages/merchant/store/storeInfo'),
            meta: { title: '门店管理', permission: ['storeInfo'] }
          },
          {
            path: '/mini/store/storeIdList',
            name: 'storeIdList',
            component: () => import('@/pages/merchant/store/storeIdList'),
            meta: { title: '门店账号管理', permission: ['storeIdList'] }
          }
        ]
      },
      //商品管理
      {
        path: '/product',
        name: 'product',
        redirect: '/product/commodity',
        component: PageView,
        meta: { title: '卡券管理', icon: 'shop', permission: ['product'] },
        children: [
          {
            path: '/product/productDetail',
            name: 'productDetail',
            hidden:true,
            component: () => import('@/pages/product/productDetail/detailsList'),
            meta: { title: '商品详情图', permission: ['productDetail'] }
          },
          {
            path: '/product/voucher',
            name: 'voucherCouponList',
            component: () => import('@/pages/product/voucherCoupon/voucherCouponList'),
            meta: { title: '代金券', permission: ['voucherCouponList'] }
          },
          {
            path: '/product/commodity',
            name: 'merCouponInfo',
            component: () => import('@/pages/product/commodity/merCouponInfo'),
            meta: { title: '商家券', permission: ['merCouponInfo'] }
          },
          {
            path: '/mini/customer/equityCard',
            name: 'equityCardList',
            component: () => import('@/pages/mini/customer/equityCardList'),
            meta: { title: '权益卡', permission: ['equityCardList'] }
          },
          {
            path: '/product/aliCoupon', //支付宝券
            name: 'aliCouponInfo',
            component: () => import('@/pages/product/aliCoupon/aliCouponInfo'),
            meta: { title: '支付宝券', permission: ['aliCouponInfo'] }
          },
          {
            path: '/product/aliEquityCard', //支付宝券权益卡
            name: 'aliEquityCardList',
            component: () => import('@/pages/product/aliCoupon/aliEquityCardInfo'),
            meta: { title: '支付宝权益卡', permission: ['aliEquityCard'] }
          }
        ]
      },
      //会员管理
      {
        path: '/member',
        name: 'member',
        redirect: '/member/memberList',
        component: PageView,
        meta: { title: '会员管理', icon: 'shop', permission: ['member'] },
        children: [
          {
            path: '/member/memberList',
            name: 'memberList',
            component: () => import('@/pages/member/memberList'),
            meta: { title: '会员列表', permission: ['memberList'] }
          },
          {
            path: '/mini/integral',
            name: 'integralList',
            component: () => import('@/pages/mini/integral/integralList'),
            meta: { title: '会员积分明细', permission: ['integralList'] }
          },
          // {
          //   path: '/mini/share',
          //   name: 'shareList',
          //   component: () => import('@/pages/mini/share/shareList'),
          //   meta: { title: '会员分享记录', permission: ['shareList'] }
          // },
          {
            path: '/member/productList',
            name: 'memberProductList',
            hidden: true,
            component: () => import('@/pages/member/product/productList'),
            meta: { title: '卡券核销记录', permission: ['memberProductList'] }
          }
        ]
      },
      //交易管理
      {
        path: '/trade',
        name: 'trade',
        redirect: '/trade/tradeList',
        component: PageView,
        meta: { title: '交易管理', icon: 'shop', permission: ['trade'] },
        children: [
          {
            path: '/trade/tradeList',
            name: 'tradeList',
            component: () => import('@/pages/trade/tradeList'),
            meta: { title: '订单记录', permission: ['tradeList'] }
          },
          {
            path: '/trade/tradeReport',
            name: 'tradeReport',
            component: () => import('@/pages/trade/tradeReportList'),
            meta: { title: '线下消费记录', permission: ['tradeReport'] }
          },
        ]
      },
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/test',
    component: BlankLayout,
    redirect: '/test/home',
    children: [
      {
        path: 'home',
        name: 'TestHome',
        component: () => import('@/views/Home')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
